from langfuse.callback import CallbackHandler
from langchain.prompts import (
    ChatPromptTemplate,
    HumanMessagePromptTemplate,
)

from langchain_core.runnables import RunnablePassthrough
from my_base_service import *

handler = CallbackHandler(
    trace_name="SayHelloToRoc",
    user_id="roc",
)

prompt = ChatPromptTemplate.from_messages([
    HumanMessagePromptTemplate.from_template("Say hello to {input}!")
])

chain = (
        {"input": RunnablePassthrough()}
        | prompt
        | get_model()
        | strParser
)

result = chain.invoke(input="roc", config={"callbacks": [handler]})
print(result)
